
#ifndef _DEFINES_H_
#define _DEFINES_H_

#define KSafeRelease(x) if((x)){(x)->Release();(x)=0;}
#define KSafeDelete(x) if((x)){delete (x);(x) = 0;}
#define KSafeDeleteArray(x) if ((x)) { delete[] (x); (x) = 0; }


// defines for small numbers
#define EPSILON_E3 (float)(1E-3)
#define EPSILON_E4 (float)(1E-4)
#define EPSILON_E5 (float)(1E-5)
#define EPSILON_E6 (float)(1E-6)
#define float_equal(a, b) ((fabs((a)-(b)) < EPSILON_E6) ? true : false)
#define lerp(a, b, t) ((a) * (1.0f - (t)) + ((b) * (t)))
#define clamp(a, b, c) (min(max((a), (b)), (c)))


typedef int TimeValue;
typedef unsigned long ColorValue;

#endif

